package breadth_first_search;

/**
 * author :  apurv verma
 * email  :  dapurv5@gmail.com
 */

/*
 * UTILITY: Can find the path length from the source cell to all cells in a 2d maze.
 */

public class MAIN {
	
	
	//USAGE
	
	public static void main(String args[]){
		
		//1: CREATE AN INSTANCE OF Maze3D class.
	
		Maze2D m2d=new Maze2D(3,new Dimension(0,2),new Dimension(2,2),"maze2dSize=3.txt");
	
		/* Here 4 is the size of the maze.
		 * (0,0) is the starting cell
		 * (3,3) is the goal cell.
		 * "maze2dSize=3.txt" has the following format
		 * 	1 1
		 *  1 2
		 *  The cell locations (1,1) and (1,2) will serve as OBSTACLES.
		 */
	
		//2:NOW CREATE AN INSTANCE OF BreadthFirstSearch2D class AND PASS THE MAZE AS THE PARAMETER.
		
		BreadthFirstSearch2D bfs2d=new BreadthFirstSearch2D(m2d);
		
		//3:INVOKE THE FUNCTION findPathLengths()
		bfs2d.findPathLengths();
	
		//4.THE PATH LENGTH WILL BE STORED AS AN 2DARRAY OF INTEGERS IN THE INSTANCE VARIABLE.
		//bfs2d.pathLengths[][]
		
		for(int i=0;i<bfs2d.pathLength[0].length;i++){
			for(int j=0;j<bfs2d.pathLength[0].length;j++){
			System.out.print(bfs2d.pathLength[i][j]+" ");
			}
		System.out.println();	
		}
		
		//THE CELLS WHICH HAVE NOT BEEN VISITED CORRESPOND TO THE -1s.
	}
}
